@mixin card-variant($background, $border) {
  background-color: $background;
  border-color: $border;

  .card-header,
  .card-footer {
    background-color: transparent;
  }
}

@mixin card-outline-variant($color) {
  background-color: transparent;
  border-color: $color;
}

@mixin card-inverse {
  .card-header,
  .card-footer {
    border-color: rgba(255,255,255,.2);
  }
  .card-header,
  .card-footer,
  .card-title,
  .card-blockquote {
    color: #fff;
  }
  .card-link,
  .card-text,
  .card-subtitle,
  .card-blockquote .blockquote-footer {
    color: rgba(255,255,255,.65);
  }
  .card-link {
    &:hover,
    &:focus {
      color: #fff;
    }
  }
}

.card {
  position: relative;
  display: block;
  margin-bottom: $line-height-computed;
  background-color: $panel-bg;
  border: 1px solid $panel-default-border;
  border-radius: $panel-border-radius;
}

.card-block {
  @include clearfix;
  padding: $panel-body-padding;
}

.card-title {
  margin-top: 0;
  margin-bottom: $line-height-computed / 2;
}

.card-subtitle {
  margin-top: ($line-height-computed / 2) * -1;
  margin-bottom: 0;
}

.card-text:last-child {
  margin-bottom: 0;
}

.card-link {
  &:hover {
    text-decoration: none;
  }

  + .card-link {
    margin-left: $grid-gutter-width / 2;
  }
}

.card {
  > .list-group:first-child {
    .list-group-item:first-child {
      @include border-top-radius($panel-border-radius);
    }
  }

  > .list-group:last-child {
    .list-group-item:last-child {
      @include border-bottom-radius($panel-border-radius);
    }
  }
}

.card-header {
  @include clearfix;
  padding: $panel-heading-padding;
  background-color: $panel-default-heading-bg;
  border-bottom: 1px solid $panel-default-border;

  &:first-child {
    border-radius: $panel-border-radius $panel-border-radius 0 0;
  }
}

.card-footer {
  @include clearfix;
  padding: $panel-footer-padding;
  background-color: $panel-footer-bg;
  border-top: 1px solid $panel-default-border;

  &:last-child {
    border-radius: 0 0 $panel-border-radius $panel-border-radius;
  }
}

.card-header-tabs {
  margin-right: -5px;
  margin-bottom: -10px;
  margin-left: -5px;
  border-bottom: 0;
}

.card-header-pills {
  margin-right: -5px;
  margin-left: -5px;
}

.card-primary {
  @include card-variant($brand-primary, $brand-primary);
}
.card-success {
  @include card-variant($brand-success, $brand-success);
}
.card-info {
  @include card-variant($brand-info, $brand-info);
}
.card-warning {
  @include card-variant($brand-warning, $brand-warning);
}
.card-danger {
  @include card-variant($brand-danger, $brand-danger);
}

.card-outline-primary {
  @include card-outline-variant($btn-primary-bg);
}
.card-outline-secondary {
  @include card-outline-variant($btn-default-border);
}
.card-outline-info {
  @include card-outline-variant($btn-info-bg);
}
.card-outline-success {
  @include card-outline-variant($btn-success-bg);
}
.card-outline-warning {
  @include card-outline-variant($btn-warning-bg);
}
.card-outline-danger {
  @include card-outline-variant($btn-danger-bg);
}

.card-inverse {
  @include card-inverse;
}

.card-blockquote {
  padding: 0;
  margin-bottom: 0;
  border-left: 0;
}

.card-img {
  border-radius: .25em;
}
.card-img-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: $panel-body-padding;
}

.card-img-top {
  @include border-top-radius($panel-border-radius);
}
.card-img-bottom {
  @include border-bottom-radius($panel-border-radius);
}
